<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>开关按钮</title>
    <style>
      .buttom {
        width: 60px;
        height: 26px;
        border-radius: 26px;
        background-color: #333;
        padding: 2px;
      }

      .buttom::before {
        content: "";
        display: block;
        width: 26px;
        height: 26px;
        border-radius: 50%;
        background-color: #fff;
      }

      input:checked + .buttom {
        background-color: #399;
      }

      input:checked + .buttom::before {
        margin-left: 34px;
      }

      input {
        display: none;
      }
    </style>
  </head>
  <body>
    <label for="switch">
      <input type="checkbox" id="switch" />
      <div class="buttom"></div>
    </label>
  </body>
</html>
